<?php

namespace App\Http\Controllers;

use App\GoodsCategoryAttr;
use Illuminate\Http\Request;

class GoodsCategoryAttrController extends Controller
{
    //根据商品分类ID获取属性列表
    public function getAttrsByCatId(Request $request){
        $cat_id = $request->filled('cat_id') ? $request->cat_id : null;
        $attrs = GoodsCategoryAttr::where('cat_id', $cat_id)->get();
        return json_encode([
            'code' => 1,
            'attrs' => $attrs
        ]);
    }
}
